package com.linovi.tree

object Main {
  def main(args: Array[String]) {
    
   def even(a: Int) = (a % 2) == 0
   def twice(t: Tree) = new Tree(t.data * 2)
    val tree = Tree(5 ,6 ,9) + 1 + 2 + 8 + 10 + 11 + 3 + 4 + 15 + 7
   /*val tree2 = tree + 3 + 4 + 15
    val tree3 = tree2 + 10
    val tree4 = tree3 - 3
    val tree5 = tree4 - 15*/
    
    println("Tree: " + tree)

    println("Search 8: " + tree.search(8).get)
    println("Search 20: " + tree.search(20))

    println("Contains 5: " + (tree contains 5))
    println("Contains 12: " + (tree contains 12))
    
    println("Remove 3: " + (tree - 4))

 /*  println("Add 3, 4 and 15: " + (tree2))
    println("Add 10: " + (tree3))
    println("Remove 3: " + (tree4))
    println("Remove 4: " + (tree5))*/
   
   println("Filtering: " + (tree.filter(even)))
  //println("Mapping: " + tree.map(twice))
   

  }
}